package com.example.filterPattern.criteria;

import com.example.filterPattern.Person;

import java.util.ArrayList;
import java.util.List;

/**
 * 单身的
 * sun 2017-12-15
 */
public class CriteriaSingle implements Criteria {
    @Override
    public List<Person> meetCriteria(List<Person> persons) {
        List<Person> singles = new ArrayList<>();
        for (Person p: persons ) {
            if("SINGLE".equalsIgnoreCase(p.getMaritalStatus())){
                singles.add(p);
            }
        }
        return singles;
    }
}
